<?php
/**
 * @link https://gitee.com/toshcn/yii2-oauth2-server
 * @copyright Copyright (c) 2018 len168.com
 * @license https://gitee.com/toshcn/yii2-oauth2-server/blob/master/LICENSE
 */

namespace toshcn\yii2\oauth2server\models;

use Yii;

/**
 * This is the model class for table "{{%oauth_users}}".
 *
 * @property string $username
 * @property string $password
 * @property string $first_name
 * @property string $last_name
 */
class OauthUsers extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%oauth_users}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['username'], 'required'],
            [['username', 'first_name', 'last_name'], 'string', 'max' => 255],
            [['password'], 'string', 'max' => 2000],
            [['username'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'username' => Yii::t('OauthUsers', 'Username'),
            'password' => Yii::t('OauthUsers', 'Password'),
            'first_name' => Yii::t('OauthUsers', 'First Name'),
            'last_name' => Yii::t('OauthUsers', 'Last Name'),
        ];
    }
}
